package com.karolak.stock.indicator;

import com.karolak.stock.data.DataManager;

public class HighTrInd extends Indicator {

	public HighTrInd(DataManager dataManager, int period, Indicator input) {
		super(dataManager, period, input);
		setName(String.format("%s%s", super.getName(), getInput().getName()));
	}

	public double execute(double x) {
		double lastInput = getDataManager().getLast(getInput().getName());
		double lastHigh = getDataManager().getLast(getName());
		double last = lastInput > lastHigh ? lastInput : lastHigh;
		return last;
	}
}
